home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Online / AmigaTalk / intuition / GadgetAttrs.st < prev    next >
Text File  |  2002-05-05  |  18KB  |  436 lines

  1. " --------------------------------------------------------------------- "
  2. " GadgetAttrs Class is a Singleton class that allows the user to        "
  3. " reference Gadget Attributes without having to remember their actual   "
  4. " hexadecimal values.                                                   "
  5. ""
  6. " The User does NOT need to create one of these, since Intuition Class  "
  7. " will instantiate the only needed instance of this Class.  See the     "
  8. " SetupIntuition.st source file for the method(s) that help the User    "
  9. " with this Class.                                                      "
  10. ""
  11. "   EXAMPLE:  'myTag <- intuition getGadgetAttr: #GA_ToggleSelect'      "
  12. ""
  13. " ALL singleton classes MUST contain the following:                     "
  14. ""
  15. "   the methods:  isSingleton AND privateSetup     AND                  "
  16. "                 uniqueInstance Class instance variable.               "
  17. " --------------------------------------------------------------------- "
  18.  
  19. Class GadgetAttributes :Dictionary ! uniqueInstance !
  20. [
  21.    isSingleton
  22.      ^ true  
  23. |  
  24.    privateNew ! newinstance !
  25.     newinstance <- super new.
  26.  
  27.     ^ newinstance
  28. |
  29.    new
  30.      ^ (self privateSetup)
  31. |
  32.    privateInitializeDictionary    "Too big for a block."
  33.  
  34.       self at: #GA_Left           put: 16r80030001.
  35.       self at: #GA_RelRight       put: 16r80030002.
  36.       self at: #GA_Top            put: 16r80030003.
  37.       self at: #GA_RelBottom      put: 16r80030004.
  38.       self at: #GA_Width          put: 16r80030005.
  39.       self at: #GA_RelWidth       put: 16r80030006.
  40.       self at: #GA_Height         put: 16r80030007.
  41.       self at: #GA_RelHeight      put: 16r80030008.
  42.       self at: #GA_Text           put: 16r80030009.
  43.       self at: #GA_Image          put: 16r8003000A.
  44.       self at: #GA_Border         put: 16r8003000B.
  45.       self at: #GA_SelectRender   put: 16r8003000C.
  46.       self at: #GA_Highlight      put: 16r8003000D.
  47.       self at: #GA_Disabled       put: 16r8003000E.
  48.       self at: #GA_GZZGadget      put: 16r8003000F.
  49.       self at: #GA_ID             put: 16r80030010.
  50.       self at: #GA_UserData       put: 16r80030011.
  51.       self at: #GA_SpecialInfo    put: 16r80030012.
  52.       self at: #GA_Selected       put: 16r80030013.
  53.       self at: #GA_EndGadget      put: 16r80030014.
  54.       self at: #GA_Immediate      put: 16r80030015.
  55.       self at: #GA_RelVerify      put: 16r80030016.
  56.       self at: #GA_FollowMouse    put: 16r80030017.
  57.       self at: #GA_RightBorder    put: 16r80030018.
  58.       self at: #GA_LeftBorder     put: 16r80030019.
  59.       self at: #GA_TopBorder      put: 16r8003001A.
  60.       self at: #GA_BottomBorder   put: 16r8003001B.
  61.       self at: #GA_ToggleSelect   put: 16r8003001C.
  62.       self at: #GA_SysGadget      put: 16r8003001D.
  63.       self at: #GA_SysGType       put: 16r8003001E.
  64.       self at: #GA_Previous       put: 16r8003001F.
  65.       self at: #GA_Next           put: 16r80030020.
  66.       self at: #GA_DrawInfo       put: 16r80030021.
  67.       self at: #GA_IntuiText      put: 16r80030022.
  68.       self at: #GA_LabelImage     put: 16r80030023.
  69.       self at: #GA_TabCycle       put: 16r80030024.
  70.       self at: #GA_GadgetHelp     put: 16r80030025.
  71.       self at: #GA_Bounds         put: 16r80030026.
  72.       self at: #GA_RelSpecial     put: 16r80030027.
  73.       self at: #GA_TextAttr       put: 16r80030028.
  74.       self at: #GA_ReadOnly       put: 16r80030029.
  75.       self at: #GA_Underscore     put: 16r8003002A.
  76.       self at: #GA_ActivateKey    put: 16r8003002B.
  77.       self at: #GA_BackFill       put: 16r8003002C.
  78.       self at: #GA_GadgetHelpText put: 16r8003002D.
  79.       self at: #GA_UserInput      put: 16r8003002E.
  80.  
  81.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  82.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  83.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  84.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  85.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  86.  
  87.       " String Gadget Attributes: "
  88.  
  89.       self at: #STRINGA_MaxChars       put: 16r80032001.
  90.       self at: #STRINGA_Buffer         put: 16r80032002.
  91.       self at: #STRINGA_UndoBuffer     put: 16r80032003.
  92.       self at: #STRINGA_WorkBuffer     put: 16r80032004.
  93.       self at: #STRINGA_BufferPos      put: 16r80032005.
  94.       self at: #STRINGA_DispPos        put: 16r80032006.
  95.       self at: #STRINGA_AltKeyMap      put: 16r80032007.
  96.       self at: #STRINGA_Font           put: 16r80032008.
  97.       self at: #STRINGA_Pens           put: 16r80032009.
  98.       self at: #STRINGA_ActivePens     put: 16r8003200A.
  99.       self at: #STRINGA_EditHook       put: 16r8003200B.
  100.       self at: #STRINGA_EditModes      put: 16r8003200C.
  101.       self at: #STRINGA_ReplaceMode    put: 16r8003200D.
  102.       self at: #STRINGA_FixedFieldMode put: 16r8003200E.
  103.       self at: #STRINGA_NoFilterMode   put: 16r8003200F.
  104.       self at: #STRINGA_Justification  put: 16r80032010.
  105.       self at: #STRINGA_LongVal        put: 16r80032011.
  106.       self at: #STRINGA_TextVal        put: 16r80032012.
  107.       self at: #STRINGA_ExitHelp       put: 16r80032013.
  108.  
  109.       self at: #LAYOUTA_LayoutObj      put: 16r80038001.
  110.       self at: #LAYOUTA_Spacing        put: 16r80038002.
  111.       self at: #LAYOUTA_Orientation    put: 16r80038003.
  112.       self at: #LAYOUTA_ChildMaxWidth  put: 16r80038004.
  113.       self at: #LAYOUTA_ChildMaxHeight put: 16r80038005.
  114.  
  115.       " Proportional Gadget Attributes: "
  116.  
  117.       self at: #PGA_Freedom       put: 16r80031001.
  118.       self at: #PGA_Borderless    put: 16r80031002.
  119.       self at: #PGA_HorizPot      put: 16r80031003.
  120.       self at: #PGA_HorizBody     put: 16r80031004.
  121.       self at: #PGA_VertPot       put: 16r80031005.
  122.       self at: #PGA_VertBody      put: 16r80031006.
  123.       self at: #PGA_Total         put: 16r80031007.
  124.       self at: #PGA_Visible       put: 16r80031008.
  125.       self at: #PGA_Top           put: 16r80031009.
  126.       self at: #PGA_NewLook       put: 16r8003100A.
  127. |
  128.    privateSetup
  129.      (uniqueInstance isNil)
  130.        ifTrue: [uniqueInstance <- self privateNew.
  131.                 self privateInitializeDictionary   
  132.                ].
  133.  
  134.      ^ self
  135. ]
  136.  
  137. " -------------------------------------------------------------------- "
  138. " GadToolsAttributes Class is a singleton class for the attribute tags "
  139. " associated with GadTools Gadgets & GadTools Menus.                   "
  140. ""
  141. " NOTE:  The keys are in Gadget Order, not numerical order in here.    "
  142. ""
  143. " The User does NOT need to create one of these, since Intuition Class "
  144. " will instantiate the only needed instance of this Class.  See the    "
  145. " SetupIntuition.st source file for the method(s) that help the User   "
  146. " with this Class.                                                     "
  147. ""
  148. "   EXAMPLE:  'myTag <- intuition getGadToolAttr: #GT_Underscore'      "
  149. ""
  150. " ALL singleton classes MUST contain the following:                    "
  151. ""
  152. "   the methods:  isSingleton AND privateSetup     AND                 "
  153. "                 uniqueInstance Class instance variable.              "
  154. " -------------------------------------------------------------------- "
  155.  
  156. Class GadToolsAttributes :Dictionary ! uniqueInstance !
  157. [
  158.    isSingleton
  159.      ^ true  
  160. |  
  161.    privateNew ! newinstance !
  162.     newinstance <- super new.
  163.  
  164.     ^ newinstance
  165. |
  166.    new
  167.      ^ (self privateSetup)
  168. |
  169.    privateInitializeDictionary        "Too big for a Block."
  170.  
  171.      "GadTools attributes (1-3, 25-37 reserved):"
  172.  
  173.      "NewMenu Attributes:"
  174.      self at: #GTMN_TextAttr          put: 16r80080031.
  175.      self at: #GTMN_FrontPen          put: 16r80080032.
  176.                 
  177.      "GTMN_Menu is used internally only!"
  178.      self at: #GTMN_Menu              put: 16r8008003C.
  179.  
  180.      " Asks CreateMenus() to validate that this is a complete menu structure: "
  181.      self at: #GTMN_FullMenu          put: 16r8008003E.
  182.  
  183.      " ti_Data is a pointer to ULONG to receive error reports from CreateMenus()"
  184.      self at: #GTMN_SecondaryError put: 16r8008003F. 
  185.      self at: #GTMN_Checkmark      put: 16r80080041. " ti_Data is checkmark img to use " 
  186.      self at: #GTMN_AmigaKey       put: 16r80080042. " ti_Data is Amiga-key img to use " 
  187.      self at: #GTMN_NewLookMenus   put: 16r80080043. " ti_Data is boolean "
  188.  
  189.      " ng_Flags control certain aspects of the gadget.  The first five control
  190.      * the placement of the descriptive text.  Each gadget kind has its 
  191.      * default, which is usually PLACETEXT_LEFT.  Consult the autodocs for
  192.      * details.
  193.      "
  194.      self at: #PLACETEXT_LEFT    put: 1.  " Right-align text on left side "
  195.      self at: #PLACETEXT_RIGHT  put: 2.  " Left-align text on right side "
  196.      self at: #PLACETEXT_ABOVE  put: 4.  " Center text above "
  197.      self at: #PLACETEXT_BELOW  put: 8.  " Center text below "
  198.      self at: #PLACETEXT_IN     put: 16. " Center text on "
  199.      self at: #NG_HIGHLABEL     put: 32. " Highlight the label "
  200.  
  201.      " NewMenus tags & flags: "                
  202.  
  203.      self at: #NM_TITLE         put: 1.
  204.      self at: #NM_ITEM          put: 2.
  205.      self at: #NM_SUB           put: 3.
  206.      self at: #NM_END           put: 0.
  207.      self at: #NM_IGNORE        put: 64.
  208.      self at: #NM_BARLABEL      put: -1.
  209.      self at: #IM_ITEM          put: 130.   " Graphical menu item "
  210.      self at: #IM_SUB           put: 131.   " Graphical menu sub-item "
  211.      self at: #NM_MENUDISABLED  put: 1.     " Same as MENU_ENABLED "
  212.      self at: #NM_ITEMDISABLED  put: 16.    " Same as ITEMENABLED "
  213.      self at: #NM_COMMANDSTRING put: 4.     " Same as COMMSEQ "
  214.      self at: #NM_FLAGMASK      put: 16r39. "(~(COMMSEQ | ITEMTEXT | HIGHFLAGS))"
  215.      self at: #NM_FLAGMASK_V39  put: 16r3D. "(~(ITEMTEXT | HIGHFLAGS))"
  216.  
  217.      " These return codes can be obtained through the GTMN_SecondaryError tag "
  218.  
  219.      " Too many menus, items, or subitems, menu has been trimmed down: "
  220.      self at: #GTMENU_TRIMMED   put: 1. 
  221.      self at: #GTMENU_INVALID   put: 2. " Invalid NewMenu array "
  222.      self at: #GTMENU_NOMEM     put: 3. " Out of memory "
  223.                 
  224.  
  225.      "General Gadget Attributes:" 
  226.      self at: #GT_VisualInfo          put: 16r80080034.
  227.      self at: #GT_Reserved1           put: 16r80080038.
  228.      self at: #GT_Underscore          put: 16r80080040.
  229.  
  230.      "String (R/W) Gadget Attributes:"
  231.      self at: #GTST_String            put: 16r8008002D.
  232.      self at: #GTST_MaxChars          put: 16r8008002E.
  233.      self at: #GTST_EditHook          put: 16r80080037.
  234.  
  235.      "Integer (R/W) Gadget Attributes:"
  236.      self at: #GTIN_Number            put: 16r8008002F.
  237.      self at: #GTIN_MaxChars          put: 16r80080030.
  238.      self at: #GTIN_EditHook          put: 16r80080037.
  239.  
  240.      "Text (read-only) Gadget Attributes:"
  241.      self at: #GTTX_Text              put: 16r8008000B.
  242.      self at: #GTTX_CopyText          put: 16r8008000C.
  243.      self at: #GTTX_Border            put: 16r80080039.
  244.      self at: #GTTX_FrontPen          put: 16r80080048.
  245.      self at: #GTTX_BackPen           put: 16r80080049.
  246.      self at: #GTTX_Justification     put: 16r8008004A.
  247.      self at: #GTTX_Clipped           put: 16r80080055.
  248.  
  249.      "Number (read-only) Gadget Attributes:"
  250.      self at: #GTNM_Number            put: 16r8008000D.
  251.      self at: #GTNM_Border            put: 16r8008003A.
  252.      self at: #GTNM_FrontPen          put: 16r80080048.
  253.      self at: #GTNM_BackPen           put: 16r80080049.
  254.      self at: #GTNM_Justification     put: 16r8008004A.
  255.      self at: #GTNM_Format            put: 16r8008004B.
  256.      self at: #GTNM_MaxNumberLen      put: 16r8008004C.
  257.      self at: #GTNM_Clipped           put: 16r80080055.
  258.  
  259.      "ListView Gadget Attributes:"
  260.      self at: #GTLV_Top               put: 16r80080005.
  261.      self at: #GTLV_Labels            put: 16r80080006.
  262.      self at: #GTLV_ReadOnly          put: 16r80080007.
  263.      self at: #GTLV_ScrollWidth       put: 16r80080008.
  264.      self at: #GTLV_ShowSelected      put: 16r80080035.
  265.      self at: #GTLV_Selected          put: 16r80080036.
  266.      self at: #GTLV_MakeVisible       put: 16r8008004E.
  267.      self at: #GTLV_ItemHeight        put: 16r8008004F.
  268.      self at: #GTLV_CallBack          put: 16r80080053.
  269.      self at: #GTLV_MaxPen            put: 16r80080054.
  270.  
  271.      "CheckBox Gadget Attributes:"
  272.      self at: #GTCB_Checked           put: 16r80080004.
  273.      self at: #GTCB_Scaled            put: 16r80080044.
  274.  
  275.      "Radio Button (Mutual Excluded) Gadget Attributes:"
  276.      self at: #GTMX_Labels            put: 16r80080009.
  277.      self at: #GTMX_Active            put: 16r8008000A.
  278.      self at: #GTMX_Spacing           put: 16r8008003D.
  279.      self at: #GTMX_Scaled            put: 16r80080045.
  280.      self at: #GTMX_TitlePlace        put: 16r80080047.
  281.  
  282.      "Cycle Gadget Attributes:"
  283.      self at: #GTCY_Labels            put: 16r8008000E.
  284.      self at: #GTCY_Active            put: 16r8008000F.
  285.  
  286.      "Palette Gadget Attributes:"
  287.      self at: #GTPA_Depth             put: 16r80080010.
  288.      self at: #GTPA_Color             put: 16r80080011.
  289.      self at: #GTPA_ColorOffset       put: 16r80080012.
  290.      self at: #GTPA_IndicatorWidth    put: 16r80080013.
  291.      self at: #GTPA_IndicatorHeight   put: 16r80080014.
  292.      self at: #GTPA_NumColors         put: 16r80080046.
  293.      self at: #GTPA_ColorTable        put: 16r80080052.
  294.  
  295.      "Slider (proportional) Gadget Attributes:"
  296.      self at: #GTSL_Min               put: 16r80080026.
  297.      self at: #GTSL_Max               put: 16r80080027.
  298.      self at: #GTSL_Level             put: 16r80080028.
  299.      self at: #GTSL_MaxLevelLen       put: 16r80080029.
  300.      self at: #GTSL_LevelFormat       put: 16r8008002A.
  301.      self at: #GTSL_LevelPlace        put: 16r8008002B.
  302.      self at: #GTSL_DispFunc          put: 16r8008002C.
  303.      self at: #GTSL_MaxPixelLen       put: 16r80080050.
  304.      self at: #GTSL_Justification     put: 16r80080051.
  305.  
  306.      "Scroller Gadget Attributes:"
  307.      self at: #GTSC_Top               put: 16r80080015.
  308.      self at: #GTSC_Total             put: 16r80080016.
  309.      self at: #GTSC_Visible           put: 16r80080017.
  310.      self at: #GTSC_Overlap           put: 16r80080018.
  311.      self at: #GTSC_Arrows            put: 16r8008003B.
  312.  
  313.      "BevelBox Attribute(s):"
  314.      self at: #GTBB_Recessed          put: 16r80080033.
  315.      self at: #GTBB_FrameType         put: 16r8008004D.
  316.  
  317.      " Bevel box frame types for GTBB_FrameType tag: "
  318.  
  319.      self at: #BBFT_BUTTON            put: 1. " Standard button gadget box "
  320.      self at: #BBFT_RIDGE             put: 2. " Standard string gadget box "
  321.      self at: #BBFT_ICONDROPBOX       put: 3. " Standard icon drop box     "
  322.  
  323.      " Justification types for GTTX_Justification & GTNM_Justification: "
  324.  
  325.      self at: #GTJ_LEFT               put: 0.
  326.      self at: #GTJ_RIGHT              put: 1.
  327.      self at: #GTJ_CENTER             put: 2.
  328.  
  329.      " The different types of messages that a listview callback hook can see: "
  330.  
  331.      self at: #LV_DRAW                put: 16r202. " draw yourself, with state "
  332.  
  333.      " Possible return values from a callback hook: "
  334.  
  335.      self at: #LVCB_OK                put: 0. " callback understands this message type "
  336.      self at: #LVCB_UNKNOWN           put: 1. " callback does not understand this message "
  337.  
  338.      " States for LVDrawMsg.lvdm_State: "
  339.  
  340.      self at: #LVR_NORMAL           put: 0. " the usual "
  341.      self at: #LVR_SELECTED         put: 1. " for selected gadgets "
  342.      self at: #LVR_NORMALDISABLED   put: 2. " for disabled gadgets "
  343.      self at: #LVR_SELECTEDDISABLED put: 8. " disabled and selected "
  344. |
  345.    privateSetup
  346.      (uniqueInstance isNil)
  347.        ifTrue: [uniqueInstance <- self privateNew.
  348.                 self privateInitializeDictionary
  349.                ].
  350.  
  351.      ^ self "uniqueInstance??"
  352. ]
  353.  
  354. " --------------------------------------------------------------------- "
  355. " GadgetMethodIDs Class is a Singleton class that allows the user to    "
  356. " reference Gadget Method IDs without having to remember their actual   "
  357. " hexadecimal values.                                                   "
  358. ""
  359. " The User does NOT need to create one of these, since Intuition Class  "
  360. " will instantiate the only needed instance of this Class.  See the     "
  361. " SetupIntuition.st source file for the method(s) that help the User    "
  362. " with this Class.                                                      "
  363. ""
  364. "   EXAMPLE:  'myTag <- intuition getMethodID: #GM_Domain'              "
  365. ""
  366. " ALL singleton classes MUST contain the following:                     "
  367. ""
  368. "   the methods:  isSingleton AND privateSetup     AND                  "
  369. "                 uniqueInstance Class instance variable.               "
  370. " --------------------------------------------------------------------- "
  371.  
  372. Class GadgetMethodIDs :Dictionary ! uniqueInstance !
  373. [
  374.    isSingleton
  375.      ^ true  
  376. |  
  377.    privateNew ! newinstance !
  378.     newinstance <- super new.
  379.  
  380.     ^ newinstance
  381. |
  382.    new
  383.      ^ (self privateSetup)
  384. |
  385.    privateInitializeDictionary    "Too big for a block."
  386.  
  387.       self at: #GM_Dummy          put: 16rFFFFFFFF.
  388.       self at: #GM_HITTEST        put: 16r0.
  389.       self at: #GM_RENDER         put: 16r1.
  390.       self at: #GM_GOACTIVE       put: 16r2.
  391.       self at: #GM_HANDLEINPUT    put: 16r3.
  392.       self at: #GM_GOINACTIVE     put: 16r4.
  393.       self at: #GM_HELPTEST       put: 16r5.
  394.       self at: #GM_LAYOUT         put: 16r6.
  395.       self at: #GM_DOMAIN         put: 16r7.
  396.       self at: #GM_KEYTEST        put: 16r8.
  397.       self at: #GM_KEYGOACTIVE    put: 16r9.
  398.       self at: #GM_KEYGOINACTIVE  put: 16rA.
  399.       
  400.       "For GM_HITTEST:" 
  401.       self at: #GMR_GADGETHIT     put: 16r4.
  402.       self at: #GMR_HOHELPHIT     put: 0.
  403.       self at: #GMR_HELPHIT       put: 16rFFFFFFFF.
  404.       self at: #GMR_HELPCODE      put: 16r00010000.
  405.  
  406.       "For GM_RENDER:"
  407.       self at: #GREDRAW_UPDATE    put: 16r2.
  408.       self at: #GREDRAW_REDRAW    put: 1.
  409.       self at: #GREDRAW_TOGGLE    put: 0.
  410.  
  411.       "For GM_HANDLEINPUT & GM_GOACTIVE:"
  412.       self at: #GMR_MEACTIVE      put: 0.
  413.       self at: #GMR_NOREUSE       put: 2.
  414.       self at: #GMR_REUSE         put: 4.
  415.       self at: #GMR_VERIFY        put: 8.
  416.       self at: #GMR_NEXTACTIVE    put: 16r10.
  417.       self at: #GMR_PREVACTIVE    put: 16r20.
  418.  
  419.       "For GM_DOMAIN:"
  420.       self at: #GDOMAIN_MINIMUM   put: 0.
  421.       self at: #GDOMAIN_NOMINAL   put: 1.
  422.       self at: #GDOMAIN_MAXIMUM   put: 2.
  423.       
  424.       "For GM_KEYGOACTIVE:"
  425.       self at: #GMR_KEYACTIVE     put: 16r10.
  426.       self at: #GMR_KEYVERIFY     put: 16r20.
  427. |
  428.    privateSetup
  429.      (uniqueInstance isNil)
  430.        ifTrue: [uniqueInstance <- self privateNew.
  431.                 self privateInitializeDictionary   
  432.                ].
  433.  
  434.      ^ self
  435. ]
  436.